package com.kylin.module.shop.orm;

import java.util.ArrayList;
import java.util.List;

import com.kylin.module.user.orm.User;

public class InquiryCar {
	
	private List inquiryCar = null;
	private Product product;
	private Company company;
	private User user;
	
	public Company getCompany() {
		return company;
	}
	public void setCompany(Company company) {
		this.company = company;
	}
	public Product getProduct() {
		return product;
	}
	public void setProduct(Product product) {
		this.product = product;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public void setInquiryCar(List inquiryCar) {
		this.inquiryCar = inquiryCar;
	}
	public InquiryCar()
	{
		inquiryCar = new ArrayList();
	}
	//检查所有询问列表中是否已存在本产品
	public boolean existProduct(String id)
	{
		for(int i=0;i<inquiryCar.size();i++)
		{
			String shopId = (String)inquiryCar.get(i);
			if(shopId.equals(id))
			{
				return true;
			}
		}
		return false;
	}
	
	//取得存放产品的list
	public List getInquiryCar()
	{
		return inquiryCar;
	}
	
	//添加产品至询问盘
	public void addInquiry(String id)
	{
		if(existProduct(id))
		{
			return ;
		}
		else
		{
			inquiryCar.add(id);
		}
	}
	//删除询问中产品
	public void deleteProduct(String productId)
	{
		inquiryCar.remove(productId);
	}
	
	//清空询问内容
	public void clearInquiry()
	{
		inquiryCar.clear();
	}

}
